package com.gopay.common.domain.ptbank;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;
import java.util.Date;

/**
 * Entity: G商融通商户和托管银行关系表
 */
@Entity
@Table(name = "GSRT_BANK_CUST_SUPERVISE_INFO")
public class GsrtBankCustSuperviseInfo implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	/**
	 * 待提交
	 */
	public static final String  BANK_STATE_TO_SUBMIT = "01";
	/**
	 * 审核拒绝
	 */
	public static final String  BANK_STATE_REFUSED = "02";
	/**
	 * 待审核
	 */
	public static final String  BANK_STATE_WAIT_CHECK = "03";
	/**
	 * 审核通过
	 */
	public static final String  BANK_STATE_PASSED = "04";
	/**
	 * 已修改未提交
	 */
	public static final String  BANK_STATE_MODIFY_TO_SUBMIT = "05";
	/**
	 * 内部银行托管银行ID
	 */
	public static final String INNER_BANK_SUPERVISE_ID = "20000";

	/** 
	 * 银行监管iD
	 */
	private Long id;

	/** 
	 * 乐观锁版本号
	 */
	private Long version;

	/**
	 * 日志表ID
	 */
	private Long logId;

	/** 
	 * 商户的Cust_id
	 */
	private String merCustId;
	/**
	 * 银行分配给平台的ID(由平台新增接口，银行返回)
	 */
	private String platId;
	/** 
	 * 托管银行平台ID
	 */
	private Long bankSuperviseId;

	/** 
	 * 托管银行名称
	 */
	private String bankSuperviseName;

	/** 
	 * 开户状态  未开户：01；已开户：02
	 */
	private String accountState;

	/** 
	 * 国付宝银行状态  启用：01；关闭：02
	 */
	private String custBankState;

	/** 
	 * 银行审核状态
	01:待提交：未提交银行审核之前的状态
	02:审核拒绝：银行审核拒绝。
	03:待审核：提交银行后的状态，因为未返回结果
	04:审核通过：银行审核完成后返回给国付宝审核通过
	05:已修改未提交 ，银行返回成功或失败的状态后，用户修改资料，需要修改状态重新提交审核
	 */
	private String bankState;

	/** 
	 * 创建时间
	 */
	private Date createdTs;

	/** 
	 * 记录最后修改时间
	 */
	private Date lastUpdTs;

	private String commentRk;

	private String remark;

	private String remark2;

	private String remark3;



	public GsrtBankCustSuperviseInfo() {
	}

	public GsrtBankCustSuperviseInfo(Long id, Long version, Long logId, String merCustId, Long bankSuperviseId,
									 String bankSuperviseName, String accountState, String custBankState,
									 String bankState, Date createdTs, Date lastUpdTs, String commentRk,
									 String remark, String remark2, String remark3) {
		this.id = id;
		this.version = version;
		this.logId = logId;
		this.merCustId = merCustId;
		this.bankSuperviseId = bankSuperviseId;
		this.bankSuperviseName = bankSuperviseName;
		this.accountState = accountState;
		this.custBankState = custBankState;
		this.bankState = bankState;
		this.createdTs = createdTs;
		this.lastUpdTs = lastUpdTs;
		this.commentRk = commentRk;
		this.remark = remark;
		this.remark2 = remark2;
		this.remark3 = remark3;
	}

	@Id
	@SequenceGenerator(name = "GsrtBankCustSuperviseInfoSequence", sequenceName = "GSRT_BANK_CUST_SUPERVISE_SEQ")
	@GeneratedValue(generator = "GsrtBankCustSuperviseInfoSequence", strategy = GenerationType.SEQUENCE)
	@Column(name = "ID", unique = true, nullable = false, precision = 22, scale = 0)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Version
	@Column(name = "VERSION", precision = 22, scale = 0)
	public Long getVersion() {
		return this.version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@Column(name = "LOG_ID", nullable = false, precision = 22, scale = 0)
	public Long getLogId() {
		return this.logId;
	}

	public void setLogId(Long logId) {
		this.logId = logId;
	}

	@Column(name = "MER_CUST_ID", nullable = false, length = 10)
	public String getMerCustId() {
		return this.merCustId;
	}

	public void setMerCustId(String merCustId) {
		this.merCustId = merCustId;
	}

	@Column(name = "BANK_SUPERVISE_ID", nullable = false, precision = 22, scale = 0)
	public Long getBankSuperviseId() {
		return this.bankSuperviseId;
	}

	public void setBankSuperviseId(Long bankSuperviseId) {
		this.bankSuperviseId = bankSuperviseId;
	}

	@Column(name = "BANK_SUPERVISE_NAME", nullable = false, length = 50)
	public String getBankSuperviseName() {
		return this.bankSuperviseName;
	}

	public void setBankSuperviseName(String bankSuperviseName) {
		this.bankSuperviseName = bankSuperviseName;
	}

	@Column(name = "ACCOUNT_STATE", nullable = false, length = 2)
	public String getAccountState() {
		return this.accountState;
	}

	public void setAccountState(String accountState) {
		this.accountState = accountState;
	}

	@Column(name = "CUST_BANK_STATE", nullable = false, length = 2)
	public String getCustBankState() {
		return this.custBankState;
	}

	public void setCustBankState(String custBankState) {
		this.custBankState = custBankState;
	}

	@Column(name = "BANK_STATE", nullable = false, length = 2)
	public String getBankState() {
		return this.bankState;
	}

	public void setBankState(String bankState) {
		this.bankState = bankState;
	}

	@Column(name = "CREATED_TS", nullable = false, length = 6)
	public Date getCreatedTs() {
		return this.createdTs;
	}

	public void setCreatedTs(Date createdTs) {
		this.createdTs = createdTs;
	}

	@Column(name = "LAST_UPD_TS", nullable = false, length = 6)
	public Date getLastUpdTs() {
		return this.lastUpdTs;
	}

	public void setLastUpdTs(Date lastUpdTs) {
		this.lastUpdTs = lastUpdTs;
	}

	@Column(name = "COMMENT_RK", length = 50)
	public String getCommentRk() {
		return this.commentRk;
	}

	public void setCommentRk(String commentRk) {
		this.commentRk = commentRk;
	}

	@Column(name = "REMARK", length = 50)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "REMARK2", length = 50)
	public String getRemark2() {
		return this.remark2;
	}

	public void setRemark2(String remark2) {
		this.remark2 = remark2;
	}

	@Column(name = "REMARK3", length = 50)
	public String getRemark3() {
		return this.remark3;
	}

	public void setRemark3(String remark3) {
		this.remark3 = remark3;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
	}
	@Column(name = "PLATID", length = 80)
	public String getPlatId() {
		return platId;
	}

	public void setPlatId(String platId) {
		this.platId = platId;
	}
	
	/**
	 * 描述：银行状态转换
	 * 时间：2016年5月4日 下午1:45:32
	 * @author : lx
	 * @param state
	 * @return
	 * String
	 */
	public static String covertState(String state){
		if("01".equals(state)){
			state="待提交";
		}else if("02".equals(state)){
			state="审核拒绝";
		}else if("03".equals(state)){
			state="待审核";
		}else if("04".equals(state)){
			state="审核通过";
		}else if("05".equals(state)){
			state="已修改未提交";
		}else{
			state="待提交";
		}
		
		return state;
	}
}
